package com.vay.de.dang.online.view;

import android.content.Context;
import android.util.AttributeSet;
import android.webkit.WebView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public class VnWebView extends WebView {

    private WebViewScrollListener listener;

    public VnWebView(@NonNull Context context) {
        super(context);
    }

    public VnWebView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onScrollChanged(int l, int t, int oldLeft, int oldTop) {
        super.onScrollChanged(l, t, oldLeft, oldTop);
        if (listener != null) {
            listener.onSChanged(l, t, oldLeft, oldTop);
        }
    }

    public void setWebViewScrollListener(WebViewScrollListener listener) {
        this.listener = listener;
    }

    public interface WebViewScrollListener {

        void onSChanged(int l, int t, int oldLeft, int oldTop);

    }
}
